package com.wangxiang.shop.product.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wangxiang.common.utils.PageUtils;
import com.wangxiang.common.utils.Query;

import com.wangxiang.shop.product.dao.PhoneSkuDao;
import com.wangxiang.shop.product.entity.PhoneSkuEntity;
import com.wangxiang.shop.product.service.PhoneSkuService;


@Service("phoneSkuService")
public class PhoneSkuServiceImpl extends ServiceImpl<PhoneSkuDao, PhoneSkuEntity> implements PhoneSkuService {
    @Autowired
    private PhoneSkuDao phoneSkuDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PhoneSkuEntity> page = this.page(
                new Query<PhoneSkuEntity>().getPage(params),
                new QueryWrapper<PhoneSkuEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<PhoneSkuEntity> sku(PhoneSkuEntity phoneSku) {
        List<PhoneSkuEntity> sku = phoneSkuDao.sku(phoneSku.getSpuId());
        return sku;
    }

    @Override
    public int add(PhoneSkuEntity phoneSku) {
        int insert = phoneSkuDao.insert(phoneSku);
        return insert;
    }

}